Creating running totals for a group
Another common use for running totals is tallying items in a group. The running total starts with the first item in the group and ends with the last. Then it starts all over again for the next group, then the next, and so on.
In this tutorial, you will create a report that:
- maintains a running total of customer orders
- groups customer orders and resets the running total for each group
- displays the subtotal for each order (the last running total for that order).
To create a running total for a group
- To get started, create a report using the sample data, Xtreme.mdb.
Link the Customers and Orders tables and place the following fields from left to right in the Details section:
{customer.CUSTOMER NAME}
{orders.ORDER ID}
{orders.ORDER AMOUNT}
- On the Insert menu, click Group and group on the {customer.CUSTOMER NAME} field.
- On the Insert menu, click Field Object.
The Field Explorer dialog box appears.
Select Running Total Fields and click New.
The Create Running Total Field dialog box appears.
- Enter the name "GroupRunningTotal" in the Running Total Name box.
- Highlight {orders.ORDER AMOUNT} in the Available Tables and Fields box, and use the first arrow button to move it over to the Field to summarize box.
- Select sum from the Type of summary list.
- In the Evaluate section of the dialog box, click For each record.
- In the Reset section of the dialog box, click On change of group and accept the default group name.
- Click OK to save the running total field.
You return to the Field Explorer dialog box.
- Place the running total field in the Details section of your report, just to the right of the {orders.ORDER AMOUNT} field.
Note: If you want to view a grand total of each group, place the running total field in the Group Footer section of your report.